home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / amac36.arc / SRCH_Q.QM < prev    next >
Text File  |  1991-03-16  |  5KB  |  94 lines

  1. * --------------------------------------------------------------------
  2. * @(4) Search/replace from command line, quit each file after rplcmnt.
  3. * --------------------------------------------------------------------
  4. *
  5. * Often the total size of files needing a "replacement" will exceed the
  6. * available memory when using SR.BAT and the startup macro @0. Macro @4
  7. * in SRCH_Q.QM is simply a modification of @0 by replacing savefile with
  8. * file, so each file is quit after replacement.
  9. *
  10. * This macro must be the first macro in the file because it is used as
  11. * the startup macro with SRQ.BAT. It cannot be run from command line!
  12. *
  13. @4      MacroBegin
  14. ***************************************** LOAD FILES
  15.         Altwordset                      * For all file names
  16.         Endfile                         * Get to end of file
  17.  LOADAGAIN:                             *
  18.         Unmarkblock                     * Unmark last file name
  19.         Find #42 "Fi" Return "B"  Return* Find file name
  20.  Jfalse  END:                           * No find ? quit
  21.         Wordright                       * Move to space
  22.         Wordright                       * Move to file name
  23.         Markcolumn                      * Mark it
  24.         Endline                         * Get all name in block
  25.         Copy                            * Copy file name to scrap
  26.         EditFile                        * Get ready to load
  27.         CurrentFilename " "             * To force return *here*
  28.         Paste Return                    * Paste file name & do it!
  29.         Cursorup                        * Go to next line
  30.  Jfalse ENDLOAD:                        * No more filenames? Done load
  31.  Jump LOADAGAIN:                        * Check again
  32.  ENDLOAD:                               *
  33.         Quit                            * Quit c:! from ring so no rplc
  34. ***************************************** GET SEARCH TEXT TO SCRATCH
  35.         Editfile "C:$" Return           * Load set output file
  36.         Find  "FGS" Return Return       * Find FGS
  37.         Wordright                       * Get to SEARCH text
  38.         Markcolumn                      * Begin mark
  39.         Endline                         * Mark SEARCH text
  40.         Cursorleft                      * No trailing space in block
  41.         Storescrbuff "FGS" Return       * Store SEARCH text to scratch
  42. ***************************************** GET REPLACE TEXT TO SCRATCH
  43.         Unmarkblock                     * Get ready
  44.         Begfile                         * Get to top
  45.         Find  "FGR" Return Return       * Find FGR
  46.         Wordright                       * Get to REPLACE text
  47.         Markcolumn                      * Begin mark
  48.         Endline                         * Mark it all
  49.         Cursorleft                      * No trailing space in block
  50.         Storescrbuff "FGR" Return       * Store REPLACE text to scratch
  51.         Killfile                        * Kill c:$ for next time
  52.         Quit                            * Remove c:$ from ring
  53. ***************************************** BEGIN SEARCH/REPLACE
  54.         Editfile "_" Return             * Insert -or- GoTo NUL File
  55.         Getscrbuff "FGS" Return Cut     * Cut search text from scratch
  56.         Find Paste Return Escape        * Initialize find prompt
  57.         Getscrbuff "FGR" Return Cut     * Cut replace text from scratch
  58.         FindReplace Return              * Begin replacement
  59.         Paste Return                    * paste REPLACEMENT text
  60. **         "GIN" Return                    ** Replace, no prompt
  61.         Pause Return                   * Allow user input of Options
  62.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  63.         LOOP:                    * Main test loop
  64.             Nextfile             * Move to next files in Ring
  65.             Cursorleft           * Move cursor left (need for NUL test)
  66.             Jfalse DOIT:         * If couldn't move to left, it's not
  67.                                  * the NUL File AND cursor position
  68.                                  * has not changed -- GO with the
  69.                                  * FindReplace
  70.                                  *ELSE
  71.                                  * Check to see if in the NUL File
  72.             Cursorleft           * Move cursor left for NUL Test
  73.             Jfalse ENDLOOP:      * If couldn't move left -- We
  74.                                  * ARE in the NUL File and Need
  75.                                  * to ENDLOOP
  76.                                  *ELSE
  77.             Cursorright          * Move back to Col. 2 in NUL File
  78.         DOIT:                    * FindReplace Loop
  79.             BegFile              * Move up in case cursor is below find
  80.             Repeatfind           * Do the FindReplace
  81.             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  82.             Quit                 * If NO CHANGES are made -- QUIT the
  83.                                  * File
  84.             Jump LOOP:           * Return to the Main Loop
  85.         SAVE:                    * Routine to Save a File with Changes
  86.             File                 * Save and quit this file after rplcmnt
  87.             Jump LOOP:           * Return to Main Loop
  88.         ENDLOOP:                 * Loop is DONE
  89.             Quit                 * Quit the NUL File
  90.   END:                           *
  91.         Defaultwordset           * set default
  92. *
  93. * 153 bytes Thu  03-07-1991  16:54:06
  94.